package cn.z2huo.productcenter.management.app.code;

import cn.z2huo.productcenter.management.enums.CodeTypeEnum;
import lombok.RequiredArgsConstructor;

/**
 * <p>
 *
 * @author z2huo
 */
@RequiredArgsConstructor
public enum CodeGenerateUtils {

    RISK(CodeTypeEnum.RISK),

    PLAN(CodeTypeEnum.PLAN),

    CLAUSE(CodeTypeEnum.CLAUSE),

    ;

    private final CodeTypeEnum codeTypeEnum;

    private static final Md5CodeGenerator md5CodeGenerator = new Md5CodeGenerator();

    private static final SnowflakeCodeGenerator snowflakeCodeGenerator = new SnowflakeCodeGenerator();

    public String generate() {
        return snowflakeCodeGenerator.generate(codeTypeEnum);
    }

    public String generateMd5() {
        return md5CodeGenerator.generate(codeTypeEnum);
    }

}
